<!DOCTYPE html>
<html>
<head>
    <title>{% block title %}隧道监测系统{% endblock %}</title>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free@6.0.0/css/all.min.css" rel="stylesheet">
    <style>
        .sidebar {
            min-height: 100vh;
            background-color: #343a40;
            transition: all 0.3s ease;
            position: sticky;
            top: 0;
            overflow-y: auto;
        }
        .sidebar .nav-link {
            color: rgba(255,255,255,.75);
            padding: 12px 15px;
            transition: all 0.2s ease;
            white-space: nowrap;
        }
        .sidebar .nav-link:hover {
            color: rgba(255,255,255,1);
            background-color: rgba(255,255,255,0.1);
        }
        .sidebar .nav-link.active {
            color: #fff;
            background-color: #007bff;
        }
        .sidebar .nav-link i {
            margin-right: 10px;
            width: 20px;
            text-align: center;
        }
        .dropdown-menu {
            background-color: #495057;
            border: none;
            margin-left: 15px;
        }
        .dropdown-item {
            color: rgba(255,255,255,.75) !important;
            padding: 8px 15px;
        }
        .dropdown-item:hover {
            background-color: rgba(255,255,255,0.1);
        }
        @media (max-width: 768px) {
            .sidebar {
                min-height: auto;
                width: 100%;
                position: relative;
            }
            .col-md-2 {
                flex: 0 0 100%;
                max-width: 100%;
            }
            .col-md-10 {
                flex: 0 0 100%;
                max-width: 100%;
            }
            .dropdown-menu {
                margin-left: 0;
            }
        }
    </style>
</head>
<body>
    <div class="container-fluid">
        <div class="row">
            <!-- 侧边栏导航 -->
            <div class="col-md-2 p-0 sidebar">
                <nav class="nav flex-column pt-3">
                    <a class="nav-link" href="{% url 'dashboard' %}">
                        <i class="fas fa-home"></i>首页
                    </a>
                    
                    <!-- 监测总览菜单 -->
                    <div class="dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                            <i class="fas fa-chart-line"></i>监测总览
                        </a>
                        <ul class="dropdown-menu bg-dark">
                            <li><a class="dropdown-item text-white" href="{% url 'stress-overview' %}">应力监测</a></li>
                            <li><a class="dropdown-item text-white" href="{% url 'displacement-overview' %}">位移监测</a></li>
                        </ul>
                    </div>
                    
                    <!-- 数据可视化菜单 -->
                    <div class="dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                            <i class="fas fa-chart-bar"></i>数据可视化
                        </a>
                        <ul class="dropdown-menu bg-dark">
                            <li><a class="dropdown-item text-white" href="{% url 'stress-chart' %}">应力数据</a></li>
                            <li><a class="dropdown-item text-white" href="{% url 'displacement-chart' %}">位移数据</a></li>
                            <li><a class="dropdown-item text-white" href="{% url 'seepage-chart' %}">渗流数据</a></li>
                            <li><a class="dropdown-item text-white" href="{% url 'temperature-chart' %}">温度数据</a></li>
                        </ul>
                    </div>
                    
                    <!-- 设备管理菜单 -->
                    <div class="dropdown">
                        <a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown">
                            <i class="fas fa-cogs"></i>设备管理
                        </a>
                        <ul class="dropdown-menu bg-dark">
                            <li><a class="dropdown-item text-white" href="{% url 'sensor-list' %}">传感器管理</a></li>
                            <li><a class="dropdown-item text-white" href="{% url 'gateway-list' %}">网关管理</a></li>
                            <li><a class="dropdown-item text-white" href="{% url 'maintenance' %}">维护记录</a></li>
                        </ul>
                    </div>
                </nav>
            </div>
            
            <!-- 主内容区 -->
            <div class="col-md-10 p-4">
                {% block content %}{% endblock %}
            </div>
        </div>
    </div>
    
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.6.4/dist/jquery.min.js"></script>
    {% block scripts %}{% endblock %}
</body>
</html>